Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / .github / instructions / kmp-common.instructions.md

Displaying Raw • View renderedDownload

.github/instructions/kmp-common.instructions.md 4e48e64e786b58d7c73280f7aa6ebf55be9e53e5 (4e48e64e) Text, 1.34 KB

---
Tc9d1d9applyTo: "**/commonMain/**/*.kt"
Tc9d1d9---

Tc9d1d9# KMP commonMain Rules

Tff7b72- NEVER import Ta5d6ff`java.*` or Ta5d6ff`android.*` in Ta5d6ff`commonMain`.
Tff7b72- Use Ta5d6ff`org.meshtastic.core.common.util.ioDispatcher` instead of Ta5d6ff`Dispatchers.IO`.
Tff7b72- Use Okio (Ta5d6ff`BufferedSource`/Ta5d6ff`BufferedSink`) instead of Ta5d6ff`java.io.*`.
Tff7b72- Use Ta5d6ff`kotlinx.coroutines.sync.Mutex` instead of Ta5d6ff`java.util.concurrent.locks.*`.
Tff7b72- Use Ta5d6ff`atomicfu` or Mutex-guarded Ta5d6ff`mutableMapOf()` instead of Ta5d6ff`ConcurrentHashMap`.
Tff7b72- Use Ta5d6ff`jetbrains-*` catalog aliases for lifecycle/navigation dependencies.
Tff7b72- Use Ta5d6ff`compose-multiplatform-*` catalog aliases for CMP dependencies.
Tff7b72- Never use plain Ta5d6ff`androidx.compose` dependencies in Ta5d6ff`commonMain`.
Tff7b72- Strings: use Ta5d6ff`stringResource(Res.string.key)` from Ta5d6ff`core:resources`. No hardcoded strings.
Tff7b72- CMP Ta5d6ff`stringResource` only supports Ta5d6ff`%N$s` and Ta5d6ff`%N$d` — pre-format floats with Ta5d6ff`NumberFormatter.format()`.
Tff7b72- Use Ta5d6ff`MetricFormatter` from Ta5d6ff`core:common` for display strings (temperature, voltage, percent, signal). Avoid scattered Ta5d6ff`formatString("%.1f°C", val)` calls.
Tff7b72- Check Ta5d6ff`gradle/libs.versions.toml` before adding dependencies.
Tff7b72- Use Ta5d6ff`safeCatching {}` from Ta5d6ff`core:common` instead of Ta5d6ff`runCatching {}` in coroutine/suspend contexts. Keep Ta5d6ff`runCatching` only in cleanup/teardown code.
Tff7b72- Use Ta5d6ff`kotlinx.coroutines.CancellationException`, not Ta5d6ff`kotlin.coroutines.cancellation.CancellationException`.

Served by rngit 1.5.2 - Generated in 0.06s